Skip to content

Conversation

@GziXnine
Copy link
Contributor

@GziXnine GziXnine commented Jan 9, 2026

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java.

Summary

Adds a modified binary search implementation for searching in a rotated sorted array.

What changed

  • Added RotatedBinarySearch implementing SearchAlgorithm.
  • Added RotatedBinarySearchTest with coverage for rotated, non-rotated, not-found, and duplicate-containing arrays.

Complexity

  • O(log n) for distinct elements.
  • May degrade to O(n) in worst-case when many duplicates exist (ambiguous sorted half).

References

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.04%. Comparing base (7148661) to head (7ba7d67).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7202      +/-   ##
============================================
+ Coverage     79.02%   79.04%   +0.01%     
- Complexity     6929     6940      +11     
============================================
  Files           777      778       +1     
  Lines         22877    22898      +21     
  Branches       4495     4501       +6     
============================================
+ Hits          18079    18099      +20     
- Misses         4077     4078       +1     
  Partials        721      721              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@DenizAltunkapan DenizAltunkapan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @GziXnine

@DenizAltunkapan DenizAltunkapan merged commit 66f76eb into TheAlgorithms:master Jan 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants